page = require('webpage').create()

address = 'http://www.163.com'
now = Date.now()

page.onConsoleMessage = (msg)->console.log  'Page title is ' + msg

page.open(address, (status)->
  (console.log "Fail to load the address " + address; return) unless 'success' == status

  console.log 'Loading time ' + (Date.now() - now) + ' msec'

  page.render '163.png'
  page.evaluate (->console.log document.title)
  phantom.exit()
)
